package com.xiaodao.imports;

import com.xiaodao.dao.CardDao;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

import javax.smartcardio.Card;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class MyImportBeanDefinition {
	/**
	 *implements ImportBeanDefinitionRegistrar
	 * @param importingClassMetadata
	 * @param registry
	 */
	/*@Override
	public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {

		//1.得到bd
		// 扫描借口--mybatis 实现方式
		BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(CardDao.class);
		GenericBeanDefinition definition = (GenericBeanDefinition) beanDefinition.getBeanDefinition();
		System.out.println(definition.getBeanClassName());
		definition.getConstructorArgumentValues().addGenericArgumentValue(definition.getBeanClassName());
		definition.setBeanClass(MyFactoryBean.class);
		//2. 原来是个接口.类型,现在我们需要改变t的beanClass
		registry.registerBeanDefinition("cardDao",definition);

	}*/


}
